package com.zhiyou.shop.service.impl;

import java.util.Date;
import java.util.HashMap;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zhiyou.shop.mapper.UserMapper;
import com.zhiyou.shop.model.UserModel;
import com.zhiyou.shop.service.IUserService;
@Service
public class UserService implements IUserService {
    @Autowired
    UserMapper mapper;
    
	@Override
	public boolean canRegister(UserModel user) {
		HashMap map = new HashMap<>();
		map.put("loginName", user.getLoginName());
		map.put("loginPsw", null);
		UserModel use=mapper.queryRegister(map);
		if(use==null){
			return true;
		}
		return false;
	}

	@Override
	public void addRegister(UserModel user) {
		user.setCreateTime(new Date());
		user.setUpdateTime(new Date());
		user.setLoginPsw(user.getLoginPsw());
		System.out.println("serviceIMPL--最后执行添加的参数：" + user);
		mapper.addRegister(user);
   
	}

}
